﻿using System;
using System.Collections;

namespace Eneta.Portal.Forum.Rss
{
    [Serializable]
    public class ExceptionCollection : CollectionBase
    {
        // Fields
        private Exception lastException = null;

        // Methods
        public int Add(Exception exception)
        {
            foreach (Exception exception2 in base.List)
            {
                if (exception2.Message == exception.Message)
                {
                    return -1;
                }
            }
            this.lastException = exception;
            return base.List.Add(exception);
        }

        public bool Contains(Exception exception)
        {
            return base.List.Contains(exception);
        }

        public void CopyTo(Exception[] array, int index)
        {
            base.List.CopyTo(array, index);
        }

        public int IndexOf(Exception exception)
        {
            return base.List.IndexOf(exception);
        }

        public void Insert(int index, Exception exception)
        {
            base.List.Insert(index, exception);
        }

        public void Remove(Exception exception)
        {
            base.List.Remove(exception);
        }

        // Properties
        public Exception this[int index]
        {
            get
            {
                return (Exception)base.List[index];
            }
            set
            {
                base.List[index] = value;
            }
        }

        public Exception LastException
        {
            get
            {
                return this.lastException;
            }
        }
    }
}
